home *** CD-ROM | disk | FTP | other *** search
/ Delphi 2.0 - Programmer's Utilities Power Pack / Delphi 2.0 Programmer's Utilities Power Pack.iso / e_to_l / itgraph / msvc15 / dlgitem.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-15  |  3.7 KB  |  102 lines

  1. // dlgitem.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "itgdemo.h"
  6. #include "dlgitem.h"
  7. #include "itgdefs.h"
  8.  
  9. #ifdef _DEBUG
  10. #undef THIS_FILE
  11. static char BASED_CODE THIS_FILE[] = __FILE__;
  12. #endif
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CDlgItem dialog
  16.  
  17.  
  18. CDlgItem::CDlgItem(CVBControl *pITGraph, CWnd* pParent /*=NULL*/)
  19.     : CDialog(CDlgItem::IDD, pParent)
  20. {
  21.     m_ITGraph = pITGraph;
  22.     int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
  23.     
  24.     //{{AFX_DATA_INIT(CDlgItem)
  25.     m_ItemId = m_ITGraph->GetNumProperty("ItemId", selIx);
  26.     m_ItemData = m_ITGraph->GetNumProperty("ItemData", selIx);
  27.     m_ItemHeight = (int)m_ITGraph->GetNumProperty("ItemHeight", selIx);
  28.     m_ItemWidth = (int)m_ITGraph->GetNumProperty("ItemWidth", selIx);
  29.     m_ItemXpos = (int)m_ITGraph->GetNumProperty("ItemXpos", selIx);
  30.     m_ItemYpos = (int)m_ITGraph->GetNumProperty("ItemYpos", selIx);
  31.     m_ItemList = m_ITGraph->GetStrProperty("List", selIx);
  32.     //}}AFX_DATA_INIT    
  33. }
  34.  
  35. void CDlgItem::DoDataExchange(CDataExchange* pDX)
  36. {    
  37.     CDialog::DoDataExchange(pDX);
  38.     //{{AFX_DATA_MAP(CDlgItem)
  39.     DDX_Text(pDX, IDC_EDTITEMID, m_ItemId);
  40.     DDX_Text(pDX, IDC_EDTITEMDATA, m_ItemData);
  41.     DDX_Text(pDX, IDC_EDTITEMHEIGHT, m_ItemHeight);
  42.     DDV_MinMaxInt(pDX, m_ItemHeight, 0, 32767);
  43.     DDX_Text(pDX, IDC_EDTITEMWIDTH, m_ItemWidth);
  44.     DDV_MinMaxInt(pDX, m_ItemWidth, 0, 32767);
  45.     DDX_Text(pDX, IDC_EDTITEMXPOS, m_ItemXpos);
  46.     DDX_Text(pDX, IDC_EDTITEMYPOS, m_ItemYpos);
  47.     DDX_Text(pDX, IDC_EDTITEMLIST, m_ItemList);
  48.     DDV_MaxChars(pDX, m_ItemList, 255);
  49.     //}}AFX_DATA_MAP
  50.        
  51.     if(!pDX->m_bSaveAndValidate) {
  52.         int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
  53.         char tmpStr[16];
  54.         
  55.         m_ITGraph->SetNumProperty("QueryItem", selIx);
  56.         m_ITGraph->SetNumProperty("QueryState", ITG_QueryGetSources);
  57.         sprintf(tmpStr, "Sources: %d", (int)m_ITGraph->GetNumProperty("QueryCount"));
  58.         SendDlgItemMessage(IDC_LBLSOURCES, WM_SETTEXT, 0, (LPARAM)tmpStr);
  59.         SendDlgItemMessage(IDC_LISTSOURCES, LB_RESETCONTENT, 0, 0);
  60.         while(m_ITGraph->GetNumProperty("QueryState") != ITG_QueryNone) {
  61.             int srcIndex = (int)m_ITGraph->GetNumProperty("ConnectFromIndex");
  62.             SendDlgItemMessage(IDC_LISTSOURCES, LB_ADDSTRING, 0, (LPARAM)(const char *)m_ITGraph->GetStrProperty("List", srcIndex));
  63.             m_ITGraph->SetNumProperty("QueryState", ITG_QueryIterate);
  64.         }
  65.         
  66.         m_ITGraph->SetNumProperty("QueryItem", selIx);
  67.         m_ITGraph->SetNumProperty("QueryState", ITG_QueryGetTargets);
  68.         sprintf(tmpStr, "Targets: %d", (int)m_ITGraph->GetNumProperty("QueryCount"));
  69.         SendDlgItemMessage(IDC_LBLTARGETS, WM_SETTEXT, 0, (LPARAM)tmpStr);
  70.         SendDlgItemMessage(IDC_LISTTARGETS, LB_RESETCONTENT, 0, 0);
  71.         while(m_ITGraph->GetNumProperty("QueryState") != ITG_QueryNone) {
  72.             int tgtIndex = (int)m_ITGraph->GetNumProperty("ConnectToIndex");
  73.             SendDlgItemMessage(IDC_LISTTARGETS, LB_ADDSTRING, 0, (LPARAM)(const char *)m_ITGraph->GetStrProperty("List", tgtIndex));
  74.             m_ITGraph->SetNumProperty("QueryState", ITG_QueryIterate);
  75.         }
  76.     }
  77. }
  78.  
  79. BEGIN_MESSAGE_MAP(CDlgItem, CDialog)
  80.     //{{AFX_MSG_MAP(CDlgItem)
  81.     //}}AFX_MSG_MAP
  82. END_MESSAGE_MAP()
  83.  
  84.  
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CDlgItem message handlers
  87.  
  88. void CDlgItem::OnOK()
  89. {
  90.     if(UpdateData(TRUE)) {
  91.         int selIx = (int)m_ITGraph->GetNumProperty("SelectedIndex");
  92.         m_ITGraph->SetStrProperty("List", m_ItemList, selIx);
  93.         m_ITGraph->SetNumProperty("ItemData", m_ItemData, selIx);
  94.         m_ITGraph->SetNumProperty("ItemXpos", m_ItemXpos, selIx);
  95.         m_ITGraph->SetNumProperty("ItemYpos", m_ItemYpos, selIx);
  96.         m_ITGraph->SetNumProperty("ItemWidth", m_ItemWidth, selIx);
  97.         m_ITGraph->SetNumProperty("ItemHeight", m_ItemHeight, selIx);
  98.         
  99.         CDialog::OnOK();
  100.     }
  101. }
  102.